﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GenerateDiagram
{
    public class SqlColumn : AbstractColumn
    {
        private int str;

        public int Str
        {
            get { return str; }
            set { str = value; }
        }
        public override string ToProperty(Common.Version netVersion)
        {
            switch (netVersion)
            {
                case Common.Version.Net2_0:
                case Common.Version.Net3_0:
                    string property = this.Name.Substring(0,1).ToLower()+ this.Name.Substring(1);
                    string proInfo = "private " + this.ColumnType.DbType + " " + property + ";";
                    proInfo += "\r";
                    proInfo += "\tpublic " + this.ColumnType.DbType + " " + this.Name;
                    proInfo += "\r\n\t{\r\n";
                    proInfo += "\t\tget { return " + property + "; }";
                    proInfo += "\r\n\t\tset { " +property+" =  value; }";
                    proInfo += "\r\n\t}\r\n";
                    return proInfo;
                case Common.Version.Net3_5:
                case Common.Version.Net4_0:
                    return "public " + this.ColumnType.DbType + (this.IsNullable ? "?" : "") + " " + this.Name + " { get; set; }";
                default:
                    return "";
            }
        }
    }
}


